Components
-
Components are modular units of software that encapsulate logic, state, and presentation.
-
They are often used in architectures such as Component-Based Architecture, common in frameworks like React, Vue.js, and Angular.
-
Main characteristics :
-
Encapsulation :
-
A component is an independent entity that can have its own state and internal logic.
-
-
Reusability :
-
It can be used in different parts of the system without code duplication.
-
-
Interoperability :
-
It can interact with other components through properties (props), events, or interfaces.
-
-
Lifecycle :
-
It can have initialization, update, and destruction phases.
-
-
Composition
About
-
Composition is a code structuring technique where objects, functions, or components are built by combining smaller, reusable entities.
-
Composition can occur in different forms, such as:
-
Object Composition :
-
An object contains other objects as attributes.
-
-
Functional Composition :
-
Functions are combined to form processing pipelines.
-
-
Component Composition :
-
A component is composed of smaller components.
-
-
Inheritance vs Composition
-
Inheritance vs Composition, by MetaphoricallySpeaking .
-
I liked the drawer organization example.
-
-
Inheritance vs Composition, by Tutemic .
-
He calls it Component Pattern instead of Composition, but I believe itβs the same thing.
-
-
In Godot
-
Composition in Godot, for defining attacks .
-
{4:55 -> 8:40}
-
He uses the combination of components to define what can happen during the attack.
-
The activation of these components is done via an AnimationPlayer dedicated to the attack.
-
-